package com.zzyweb.managementsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzyweb.managementsystem.pojo.Menu;
import com.zzyweb.managementsystem.pojo.UserInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.context.annotation.Primary;

import java.util.List;
@Mapper
public interface MenuMapper extends BaseMapper<Menu> {
    @Select("select * from t_menu m " +
            "join t_role_menu rm on m.mid = rm.mid " +
            "join t_user_role ur on rm.rid = ur.rid " +
            "join userinfo ui on ui.id = ur.uid " +
            "where ui.username = #{username}")
    List<Menu> selectMenusByUserName(@Param("username") String username);
}
